import axiosInstance from "../utils/axios.ts";
import type {DeviceVO} from "../types";
import {type MaybeRef, unref} from "vue";

export const getDevice = (companyId: number) => {
  return axiosInstance.post("/device/getList", undefined, {
    params: {
      id: companyId
    }
  })
}

export const insertDevice = (device: DeviceVO) => {
  return axiosInstance.post("/device/save", device)
}

export const deleteDevice = (id: number) => {
  return axiosInstance.delete<any, boolean>("/device/delete", {
    params: {
      id
    }
  })
}

export const updateDevice = (device: MaybeRef<DeviceVO>) => {
  return axiosInstance.put<any, boolean>("/device/update",unref(device))
}
